package com.qi.dao;

import com.qi.pojo.User;
import org.apache.ibatis.annotations.*;

import java.util.List;

/**
 * @author zjq
 * @date 2020/3/11 15:41
 */
public interface UserMapper {
    @Select("select * from user")
    List<User> getUsers();

    //方法存在多个参数，所有的参数前面需要加@Param 并且以@param为主。
    @Select("select * from user where id = #{id}")
    User getUserByID(@Param("id") int id);

    @Insert("insert into user(id,name,pwd) values(#{id},#{name},#{password})")
    int addUser(User user);

    @Update("update user set name=#{name},pwd=#{password} where id=#{id}")
    int updateUser(User user);

    @Delete("delete from user where id=#{id}")
    int deltetUser(@Param("id") int id);
}
